# Contributor: Mehdi Chinoune <mehdi.chinoune@hotmail.com>

_realname=pyqt6-sip
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=13.10.2
pkgrel=1
pkgdesc="The sip module support for PyQt6 (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://github.com/Python-SIP/sip"
msys2_references=(
  'purl: pkg:pypi/pyqt6-sip'
)
license=('spdx:BSD-2-Clause')
depends=("${MINGW_PACKAGE_PREFIX}-python")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-build"
             "${MINGW_PACKAGE_PREFIX}-python-installer"
             "${MINGW_PACKAGE_PREFIX}-python-setuptools"
             "${MINGW_PACKAGE_PREFIX}-cc")
source=(https://pypi.python.org/packages/source/P/PyQt6_sip/pyqt6_sip-${pkgver}.tar.gz)
sha256sums=('464ad156bf526500ce6bd05cac7a82280af6309974d816739b4a9a627156fafe')

prepare() {
  cd "${srcdir}"
  rm -rf python-build-${MSYSTEM} | true
  cp -r "PyQt6_sip-${pkgver}" "python-build-${MSYSTEM}"
}

build() {
  cd python-build-${MSYSTEM}
  ${MINGW_PREFIX}/bin/python -m build --wheel --skip-dependency-check --no-isolation
}

package(){
  cd "${srcdir}"/python-build-${MSYSTEM}
  MSYS2_ARG_CONV_EXCL="--prefix=" \
    ${MINGW_PREFIX}/bin/python -m installer --prefix=${MINGW_PREFIX} \
    --destdir="${pkgdir}" dist/*.whl

  install -Dm644 LICENSE "${pkgdir}"${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE
}
